home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
cxt220.zip
/
CXT_ME.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-03-20
|
12KB
|
347 lines
;*****************************************************************************
;
; CXT_ME.CMD - MicroEMACS MACRO FUNCTIONS FOR
;
; CSTN (TM) C STRUCTURE TREE NAVIGATOR
; CFTN (TM) C FUNCTION TREE NAVIGATOR
;
; Copyright (C) Juergen Mueller (J.M.) 1992-1994
; All rights reserved.
;
; You are expressly prohibited from selling this software in any form,
; distributing it with another product, or removing this notice.
;
; Limited permission is given to registered CXT users to modify this
; file for their own personal use only. This file may not be used for any
; purpose other than in conjunction with the CXT software package.
;
; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
; EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE
; IMPLIED WARRANTIES OF MERCHANTIBILITY OR FITNESS FOR A PARTICULAR
; PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
; PROGRAM AND DOCUMENTATION IS WITH YOU.
;
; written by: Juergen Mueller, Aldingerstrasse 22, D-70806 Kornwestheim,
; GERMANY
;
; FILE : CXT_ME.CMD
; REVISION : 16-Mar-1994
; 20:49:47
;
;*****************************************************************************
; NOTE: for OS/2 you should exchange "cftn" with "cftn4os2"
; NOTE: for OS/2 you should exchange "cstn" with "cstn4os2"
; NOTE: for NT you should exchange "cftn" with "cftn4nt"
; NOTE: for NT you should exchange "cstn" with "cstn4nt"
;*****************************************************************************
;**** write initial message ****
;*****************************************************************************
write-message "Loading CXT macro package"
;*****************************************************************************
;**** macro package initialization section ****
;*****************************************************************************
set %cxt_item "" ; set internal variables
set %cxt_file ""
set %cxt_line ""
set %cxtn_cmd ""
set %char_set "_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
set %cft_base &env "CFTNBASE" ; get environment variables, if set
!if &seq &len %cft_base 0
set %cft_base &env "CXTNBASE"
!if &seq &len %cft_base 0
set %cft_base ""
!endif
!endif
set %cst_base &env "CSTNBASE" ; get environment variables, if set
!if &seq &len %cst_base 0
set %cst_base &env "CXTNBASE"
!if &seq &len %cst_base 0
set %cst_base ""
!endif
!endif
;*****************************************************************************
;**** definition of user macros ****
;*****************************************************************************
;**** find function ****
store-procedure cft
execute-procedure _extract_item ; get tagged item
execute-procedure _cxt_cft
!endm
;**** find data type ****
store-procedure cst
execute-procedure _extract_item ; get tagged item
execute-procedure _cxt_cst
!endm
;**** find function ****
store-procedure cftmark
execute-procedure _extract_marked_item ; get marked item
execute-procedure _cxt_cft
!endm
;**** find function ****
store-procedure cstmark
execute-procedure _extract_marked_item ; get marked item
execute-procedure _cxt_cst
!endm
;**** find function ****
store-procedure cftfind
set %cxt_item "CFT function name: "
set %cxt_item @%cxt_item ; get user input
execute-procedure _cxt_cft
!endm
;**** find data type ****
store-procedure cstfind
set %cxt_item "CST data type name: "
set %cxt_item @%cxt_item ; get user input
execute-procedure _cxt_cst
!endm
;**** set CFT database name ****
store-procedure cftbase
set %cft_base "CFT database name: "
set %cft_base @%cft_base ; get user input
!endm
;**** set CST database name ****
store-procedure cstbase
set %cst_base "CST database name: "
set %cst_base @%cst_base ; get user input
!endm
;**** set CFT and CST database name ****
store-procedure cxtbase
set %cxt_base "CFT and CST database name: "
set %cxt_base @%cxt_base ; get user input
set %cft_base %cxt_base
set %cst_base %cxt_base
!endm
;**** CFT file list
store-procedure cftfile
write-message "Extracting CFT filelist"
!if ¬ &seq &len %cft_base 0
set %tmp &cat &cat "-f" %cft_base " " ; database access path
!else
set %tmp ""
!endif
set %cxtn_cmd &cat "cftn -F " %tmp
pipe-command %cxtn_cmd ; perform database access, shell command
!endm
;**** CST file list
store-procedure cstfile
write-message "Extracting CST filelist"
!if ¬ &seq &len %cst_base 0
set %tmp &cat &cat "-f" %cst_base " " ; database access path
!else
set %tmp ""
!endif
set %cxtn_cmd &cat "cstn -F " %tmp
pipe-command %cxtn_cmd ; perform database access, shell command
!endm
;*****************************************************************************
;**** internal macro execution functions ****
;*****************************************************************************
;*****************************************************************************
;* CFT front-end *
;*****************************************************************************
store-procedure _cxt_cft
!if &seq &len %cxt_item 0
write-message "No function selected"
!return
!endif
write-message &cat &cat "Searching for function: '" %cxt_item "'"
!if ¬ &seq &len %cft_base 0
set %tmp &cat &cat "-f" %cft_base " " ; database access path
!else
set %tmp ""
!endif
set %cxtn_cmd &cat &cat "cftn -b " %tmp %cxt_item
execute-procedure _cxt_search ; start search
!endm
;*****************************************************************************
;* CST front-end *
;*****************************************************************************
store-procedure _cxt_cst
!if &seq &len %cxt_item 0
write-message "No data type selected"
!return
!endif
write-message &cat &cat "Searching for data type: '" %cxt_item "'"
!if ¬ &seq &len %cst_base 0
set %tmp &cat &cat "-f" %cst_base " " ; database access path
!else
set %tmp ""
!endif
set %cxtn_cmd &cat &cat "cstn -b " %tmp %cxt_item
execute-procedure _cxt_search ; start search
!endm
;*****************************************************************************
;* the database retrieval function *
;*****************************************************************************
store-procedure _cxt_search
set %cxt_file "" ; clear variables
set %cxt_line ""
!force pipe-command %cxtn_cmd ; perform database access, shell command
!if &seq $status FALSE
!return
!endif
!force select-buffer command ; get result buffer from pipe-command
!if &seq $status FALSE
!return
!endif
!force beginning-of-file ; go to file begin
!if &seq $status FALSE
!return
!endif
set-mark ; extract target file name
!force search-forward " " ; search for first blank after file name
!if &seq $status FALSE
!return
!endif
backward-character
copy-region
set %cxt_file $kill ; store target file name
forward-character
set-mark ; extract target file line
end-of-line
copy-region
set %cxt_line $kill ; store target file line